package com.ibm.db2oncampus.portal.seguranca.domain;

import java.util.List;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.ibm.db2oncampus.portal.framework.domain.DomainObject;

/**
 * 
 * @author Wellington
 *
 */
public class Module implements DomainObject {

    private static final long serialVersionUID = 1L;
    private Long id;
    private String name;
    private String description;
    private Boolean menuItemIndex;
    private Integer menuItemOrder;
    private Module module;
    private List<Functionality> functionalities;
    private List<Module> modules;
	
	public Module() {
    }

    public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Boolean getMenuItemIndex() {
		return menuItemIndex;
	}

	public void setMenuItemIndex(Boolean menuItemIndex) {
		this.menuItemIndex = menuItemIndex;
	}

	public Integer getMenuItemOrder() {
		return menuItemOrder;
	}

	public void setMenuItemOrder(Integer menuItemOrder) {
		this.menuItemOrder = menuItemOrder;
	}

	public Module getModule() {
		return module;
	}

	public void setModule(Module module) {
		this.module = module;
	}

	public List<Functionality> getFunctionalities() {
		return functionalities;
	}

	public void setFunctionalities(List<Functionality> functionalities) {
		this.functionalities = functionalities;
	}

	public List<Module> getModules() {
		return modules;
	}

	public void setModules(List<Module> modules) {
		this.modules = modules;
	}

	public String toString() {
        return (new ToStringBuilder(this)).append("codigo", getId()).toString();
    }

    public boolean equals(Object other) {
        if(!(other instanceof Module))  {
            return false;
        } else {
            Module castOther = (Module)other;
            return (new EqualsBuilder()).append(getId(), castOther.getId()).isEquals();
        }
    }

    public int hashCode() {
        return (new HashCodeBuilder()).append(getId()).toHashCode();
    }
}